package kr.saeildamil.androidstudy_second.draw;

import kr.saeildamil.androidstudy_second.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

public class BlurFilter extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new MyView(this));
	}
	
	public class MyView extends View{
		Paint paint;
		Bitmap cup;
		BlurMaskFilter blur;
		
		public MyView(Context context) {
			super(context);
			paint = new Paint();
			paint.setAntiAlias(true);
			
			cup = BitmapFactory.decodeResource(getContext().getResources(),R.drawable.korandoc);
			blur = new BlurMaskFilter(20, BlurMaskFilter.Blur.NORMAL);
			
			paint.setMaskFilter(blur);
		}
		
		@Override
		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
			canvas.drawColor(Color.LTGRAY);
			canvas.drawBitmap(cup, 30, 30, paint);
		}
		
	}
}
